package com.controller;




import com.controller.reqdto.AddAddressParam;
import com.controller.reqdto.AddressQueryParam;
import com.controller.reqdto.AddressUpdateParam;
import com.controller.template.ResultHelper;
import com.controller.template.ResultInfo;
import com.service.AddressService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


/**
 * @author ruiwen
 */
@RestController
@Api(tags = "场地模块")
@CrossOrigin
@RequestMapping("/address")
public class AddressController extends ResultHelper {
    @Resource
    AddressService addressService;

    /**
     * 获取地区列表
     *
     * @param
     * @return
     */
    @ApiOperation("获取全部地区列表")
    @GetMapping("/allAddressList")
    public ResultInfo getAllAddressList() {
        return successResultInfo(addressService.getAddressList());
    }

    /**
     * 分页获取地区列表
     *
     * @param queryParam
     * @return
     */
    @ApiOperation("分页获取地区列表")
    @PostMapping("/queryAddressList")
    public ResultInfo queryAddressList(@RequestBody AddressQueryParam queryParam) {
        return successResultInfo(addressService.queryAddressList(queryParam));
    }


    /**
     * pcName
     *
     * @param updateParam
     * @return
     */
    @ApiOperation("更新地区信息")
    @PostMapping("/updateAddressMsg")
    public ResultInfo updateAddressMsg(@RequestBody AddressUpdateParam updateParam) {
        return successResultInfo(addressService.updateAddressMsg(updateParam));
    }

    /**
     * 删除地区信息
     *
     * @param
     * @return
     */
    @ApiOperation("删除地区信息")
    @PostMapping("/deleteAddress")
    public ResultInfo deleteAddress(Integer id) {
        return successResultInfo(addressService.deleteAddress(id));
    }
    /**
     * 分页获取地区列表
     *
     * @param
     * @return
     */
    @ApiOperation("新增地区信息")
    @PostMapping("/addAddress")
    public ResultInfo addAddress(@RequestBody AddAddressParam addAddress) {
        return successResultInfo(addressService.addAddress(addAddress));
    }


}
